<template>
	<view>
		<u-navbar :is-back="false" title="　" :border-bottom="false">
			<view class="u-flex u-row-right" style="width: 100%;">
				<view class="camera u-flex u-row-center">
				</view>
			</view>
		</u-navbar>
		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
			<view class="u-m-r-10">
				<u-avatar :src="form.imageUrl" size="140"></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20" v-model="form.userName">{{form.userName}}</view>
				<view class="u-font-14 u-tips-color" v-model="form.jobNumber">员工工号:{{form.jobNumber}}</view>
			</view>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="account" title="个人信息" @click="toPersonInfo"></u-cell-item>
			</u-cell-group>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="order" title="绑定工位" @click="toBindPage"></u-cell-item>
				<u-cell-item icon="eye" title="质量检查" @click="toEcQualityTest"></u-cell-item>
				<u-cell-item icon="red-packet" title="绩效查询" @click="toPerformancePage"></u-cell-item>
				<u-cell-item icon="file-text" title="维修记录" @click="toFeedBackForm"></u-cell-item>
				<u-cell-item icon="file-text" title="设备点检" @click="toSpotCheckList('设备点检')"></u-cell-item>
				<u-cell-item icon="file-text" title="设备保养" @click="toSpotCheckList('设备保养')"></u-cell-item>
			</u-cell-group>
		</view>
		</view>
	</view>
</template>

<script>
import { accessPersonInfo } from '../../../utils/index.js'
	export default {
		data() {
			return {
				form: {
					userName:'',		//用户姓名
					jobNumber:'',		//员工工号
					imageUrl:'',			//用户头像
					feedbackForm: uni.getStorageSync('feedbackForm'),
					isfeedback: false
				}
			}
		},
		onLoad() {
			this.getUserInfo()
			if(uni.getStorageSync('feedbackForm')){
				this.isfeedback = true
			}
			
		},
		methods: {
			toSpotCheckList(name){
							uni.navigateTo({
								url:'../../../publicPage/spotCheckList?name=' + name
							})
						},
			toFeedBackForm(){
				uni.navigateTo({
					url:'../../../publicPage/feedBackForm'
				})
			},
			toPersonInfo(){
				uni.navigateTo({
					url:'../../../publicPage/personInfo'
				})
			},
			// 跳转绩效查询页面
			toPerformancePage(){
				uni.navigateTo({
					url:'../../../publicPage/performance'
				})
			},
			toBindPage(){
				uni.navigateTo({
					url:'../../../publicPage/bindPage'
				})
			},
			// 跳转至公共页面，质量检查
			toEcQualityTest() {
				uni.navigateTo({
					url:'../../../publicPage/scanCheck'
				})
			},
			async getUserInfo(){
				const {data} = await accessPersonInfo()
				this.form = Object.assign({},data.data)
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #ededed;
}

.camera{
	width: 54px;
	height: 44px;
	
	&:active{
		background-color: #ededed;
	}
}
.user-box{
	background-color: #fff;
}
</style>